#include <math.h>
#include <stdio.h>

void main() {
  FILE *arq1 = NULL, *arq2 = NULL;
  char c;
  int num_linhas = 0;
  if(((arq1 = fopen("arq605a.txt","r")) != NULL) && ((arq2 = fopen("arq605b.txt","w")) != NULL)) {			
	while ((c = fgetc(arq1)) != EOF) { 
	  if(c == '\n') 
		num_linhas++;
	  fputc(c, arq2);
	}
	printf("Linhas: %d\n", num_linhas);
	fclose(arq1);
	fclose(arq2);
  }			
}
